import request from '@/utils/request'
import qs from 'qs'
  
export function getJobList(data) {//获取招聘信息列表
    return request({
      url: '/admin/jobList', 
      method: 'get',
      params:data
    })
  }

export function addJob(data) {// 新建招聘信息
    return request({
      url: '/admin/job', 
      method: 'post',
      transformRequest: [
        function (data) {
            //在请求之前对data传参进行格式转换
            data = qs.stringify(data);
            return data;
        }
      ],
      data,
      headers:{
        'Content-Type':'application/x-www-form-urlencoded'
      }
    })
}

export function editJob(data) {// 修改招聘信息
    return request({
      url: '/admin/job', 
      method: 'put',
      transformRequest: [
        function (data) {
            //在请求之前对data传参进行格式转换
            data = qs.stringify(data);
            return data;
        }
      ],
      data,
      headers:{
        'Content-Type':'application/x-www-form-urlencoded'
      }
    })
}

export function getJob(data) {// 获取招聘信息
    return request({
      url: '/admin/job', 
      method: 'get',
      params:data
    })
}

export function deleteJob(data) {// 获取招聘信息
    return request({
      url: '/admin/job', 
      method: 'delete',
      params:data
    })
}

export function getJobInfoList(data){
  return request({
    url: '/recruitment/home', 
    method: 'get',
    params:data,
    headers:{
      'Content-Type':'application/x-www-form-urlencoded'
    }
  })
}